#include <stdio.h>

void f(int a)
{
	switch(a) {
		case 0: printf("zero\n"); break;
		case 1: printf("1zero\n"); break;
		case 2: printf("2zero\n"); break;
		case 3: printf("3zero\n"); break;
		case 4: printf("4ro\n"); break;
		default: printf("something unknown\n"); break;
	}
}

void main()
{
	f(2);
}


#if 0

存在大量case分支的情况下，编译器就不能直接套用大量JE/JNE了，否则程序代码肯定会非常大。


#endif

#if 0
/*
 * intel
 */
0000000000001149 <f>:
    1149:	f3 0f 1e fa          	endbr64 
    114d:	55                   	push   %rbp
    114e:	48 89 e5             	mov    %rsp,%rbp
    1151:	48 83 ec 10          	sub    $0x10,%rsp
    1155:	89 7d fc             	mov    %edi,-0x4(%rbp)
    1158:	83 7d fc 04          	cmpl   $0x4,-0x4(%rbp)
    115c:	77 6a                	ja     11c8 <f+0x7f>
    115e:	8b 45 fc             	mov    -0x4(%rbp),%eax
    1161:	48 8d 14 85 00 00 00 	lea    0x0(,%rax,4),%rdx
    1168:	00 
    1169:	48 8d 05 c4 0e 00 00 	lea    0xec4(%rip),%rax        # 2034 <_IO_stdin_used+0x34>
    1170:	8b 04 02             	mov    (%rdx,%rax,1),%eax
    1173:	48 98                	cltq   
    1175:	48 8d 15 b8 0e 00 00 	lea    0xeb8(%rip),%rdx        # 2034 <_IO_stdin_used+0x34>
    117c:	48 01 d0             	add    %rdx,%rax
    117f:	3e ff e0             	notrack jmpq *%rax
    1182:	48 8d 3d 7b 0e 00 00 	lea    0xe7b(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    1189:	e8 c2 fe ff ff       	callq  1050 <puts@plt>
    118e:	eb 45                	jmp    11d5 <f+0x8c>
    1190:	48 8d 3d 72 0e 00 00 	lea    0xe72(%rip),%rdi        # 2009 <_IO_stdin_used+0x9>
    1197:	e8 b4 fe ff ff       	callq  1050 <puts@plt>
    119c:	eb 37                	jmp    11d5 <f+0x8c>
    119e:	48 8d 3d 6a 0e 00 00 	lea    0xe6a(%rip),%rdi        # 200f <_IO_stdin_used+0xf>
    11a5:	e8 a6 fe ff ff       	callq  1050 <puts@plt>
    11aa:	eb 29                	jmp    11d5 <f+0x8c>
    11ac:	48 8d 3d 62 0e 00 00 	lea    0xe62(%rip),%rdi        # 2015 <_IO_stdin_used+0x15>
    11b3:	e8 98 fe ff ff       	callq  1050 <puts@plt>
    11b8:	eb 1b                	jmp    11d5 <f+0x8c>
    11ba:	48 8d 3d 5a 0e 00 00 	lea    0xe5a(%rip),%rdi        # 201b <_IO_stdin_used+0x1b>
    11c1:	e8 8a fe ff ff       	callq  1050 <puts@plt>
    11c6:	eb 0d                	jmp    11d5 <f+0x8c>
    11c8:	48 8d 3d 50 0e 00 00 	lea    0xe50(%rip),%rdi        # 201f <_IO_stdin_used+0x1f>
    11cf:	e8 7c fe ff ff       	callq  1050 <puts@plt>
    11d4:	90                   	nop
    11d5:	90                   	nop
    11d6:	c9                   	leaveq 
    11d7:	c3                   	retq   

00000000000011d8 <main>:
    11d8:	f3 0f 1e fa          	endbr64 
    11dc:	55                   	push   %rbp
    11dd:	48 89 e5             	mov    %rsp,%rbp
    11e0:	bf 02 00 00 00       	mov    $0x2,%edi
    11e5:	e8 5f ff ff ff       	callq  1149 <f>
    11ea:	90                   	nop
    11eb:	5d                   	pop    %rbp
    11ec:	c3                   	retq   
    11ed:	0f 1f 00             	nopl   (%rax)

/*
 * arm
 */
000000000040055c <f>:
  40055c:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
  400560:	910003fd 	mov	x29, sp
  400564:	b9001fa0 	str	w0, [x29, #28]
  400568:	b9401fa0 	ldr	w0, [x29, #28]
  40056c:	7100081f 	cmp	w0, #0x2
  400570:	540002a0 	b.eq	4005c4 <f+0x68>  // b.none
  400574:	7100081f 	cmp	w0, #0x2
  400578:	540000cc 	b.gt	400590 <f+0x34>
  40057c:	7100001f 	cmp	w0, #0x0
  400580:	54000120 	b.eq	4005a4 <f+0x48>  // b.none
  400584:	7100041f 	cmp	w0, #0x1
  400588:	54000160 	b.eq	4005b4 <f+0x58>  // b.none
  40058c:	1400001a 	b	4005f4 <f+0x98>
  400590:	71000c1f 	cmp	w0, #0x3
  400594:	54000200 	b.eq	4005d4 <f+0x78>  // b.none
  400598:	7100101f 	cmp	w0, #0x4
  40059c:	54000240 	b.eq	4005e4 <f+0x88>  // b.none
  4005a0:	14000015 	b	4005f4 <f+0x98>
  4005a4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005a8:	911b8000 	add	x0, x0, #0x6e0
  4005ac:	97ffffa9 	bl	400450 <puts@plt>
  4005b0:	14000015 	b	400604 <f+0xa8>
  4005b4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005b8:	911ba000 	add	x0, x0, #0x6e8
  4005bc:	97ffffa5 	bl	400450 <puts@plt>
  4005c0:	14000011 	b	400604 <f+0xa8>
  4005c4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005c8:	911bc000 	add	x0, x0, #0x6f0
  4005cc:	97ffffa1 	bl	400450 <puts@plt>
  4005d0:	1400000d 	b	400604 <f+0xa8>
  4005d4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005d8:	911be000 	add	x0, x0, #0x6f8
  4005dc:	97ffff9d 	bl	400450 <puts@plt>
  4005e0:	14000009 	b	400604 <f+0xa8>
  4005e4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005e8:	911c0000 	add	x0, x0, #0x700
  4005ec:	97ffff99 	bl	400450 <puts@plt>
  4005f0:	14000005 	b	400604 <f+0xa8>
  4005f4:	90000000 	adrp	x0, 400000 <_init-0x3e8>
  4005f8:	911c2000 	add	x0, x0, #0x708
  4005fc:	97ffff95 	bl	400450 <puts@plt>
  400600:	d503201f 	nop
  400604:	d503201f 	nop
  400608:	a8c27bfd 	ldp	x29, x30, [sp], #32
  40060c:	d65f03c0 	ret

0000000000400610 <main>:
  400610:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400614:	910003fd 	mov	x29, sp
  400618:	52800040 	mov	w0, #0x2                   	// #2
  40061c:	97ffffd0 	bl	40055c <f>
  400620:	d503201f 	nop
  400624:	a8c17bfd 	ldp	x29, x30, [sp], #16
  400628:	d65f03c0 	ret
  40062c:	00000000 	.inst	0x00000000 ; undefined


#endif

